package com.yunfei.api.v2.service;
import com.yunfei.api.v2.contants.AppKeyContant;
import com.yunfei.api.v2.param.LongTokenParam;
import com.yunfei.utils.http.HttpIOUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* @Description: 获取长效令牌
* @Author: zhengyunfei
* @Date: 2019/8/9
* @time:10:48
*/
@Service
public class GetLongTokenService {
    @Autowired
    private Environment env;
    public String getLongToken(LongTokenParam param){
        String result="";
        Map<String,Object> queryMap=new HashMap<>();
        try{
            String appId=env.getProperty(AppKeyContant.appId);
            String appKey=env.getProperty(AppKeyContant.appKey);
            HttpIOUtil httpIOUtil=new HttpIOUtil();
            result= httpIOUtil.getLongToken(appId,appKey,param.getSignerId());
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }

}
